#include <func.h>

void *function(void*p)
{
    printf("i want to sleep\n");
    sleep(2);
    printf("i am awake\n");
    return NULL;
}

int main()
{
    pthread_t pth;
    long i=1;
    int ret=pthread_create(&pth,NULL,function,NULL);
    THREAD_ERR_CHECK(ret,"pthread_create");
    long ret_thread;
    ret=pthread_cancel(pth);
    THREAD_ERR_CHECK(ret,"pthread_cancel");
    printf("i am main\n");
    return 0;
}